; analytic xHI solution for tau0 * xHI << 1
;-------------------------------------------------------------

function x_tau0_x_small, nH, T, GHI, tau0, y, dbg=dbg

  if n_elements(dbg) eq 0 then dbg = 0

  nH = double(nH)
  T  = double(T)
  GHI = double(GHI)
  tau0 = double(tau0)
  y = double(y)

  CI = hici_hui( T )
  RC = hiirca_hui( T )

  CI = double(CI)
  RC = double(RC)

  RR = GHI * tau0 + (CI + RC) * nH
  QQ = -( GHI + (CI+2*RC) * nH + (CI+RC) * nH * y )
  PP = RC * nH * (1+y)
  d = QQ*QQ - 4 * PP * RR

  q = - 0.5d0 * (QQ + abs(QQ)/QQ * sqrt(d))
  
  xHIp = q / RR
  xHIm = PP / q                ; this one

  if dbg then begin
      print
      print, 'RR: ', RR, format='(A,E30.15)'
      print, 'QQ: ', QQ, format='(A,E30.15)'
      print, 'PP: ', PP, format='(A,E30.15)'
      print, 'd:  ', d, format='(A,E30.15)'
      print, 'q:  ', q, format='(A,E30.15)'
      print
  endif

  return, xHIm

end
